#ifndef INFINITY_ITEM_MATERIAL_LIBRARY_H
#	define INFINITY_ITEM_MATERIAL_LIBRARY_H

#include "itemmaterial.h"

namespace infinity {

	class ItemMaterialLibrary
	{
	public : //! @name Cosntants
		//! @{
		static const dw::uint32 MaterialsMaxCount = 256;
		//! @}

	public : //! @name Construction & Destruction
		//! @{
		ItemMaterialLibrary()
		{
			dw::float32 texCoordsScale = 1.0f / 16.0f;

			m_materials[0].setName("coal");
			m_materials[0].setOffset(texCoordsScale * dw::maths::vec2(7.0f, 0.0f));

			m_materials[1].setName("iron");
			m_materials[1].setOffset(texCoordsScale * dw::maths::vec2(8.0f, 2.0f));

			m_materials[2].setName("gold");
			m_materials[2].setOffset(texCoordsScale * dw::maths::vec2(9.0f, 4.0f));

			m_materials[3].setName("redstone");
			m_materials[3].setOffset(texCoordsScale * dw::maths::vec2(8.0f, 3.0f));

			m_materials[4].setName("diamond");
			m_materials[4].setOffset(texCoordsScale * dw::maths::vec2(7.0f, 3.0f));

			m_materials[5].setName("seed");
			m_materials[5].setOffset(texCoordsScale * dw::maths::vec2(9.0f, 0.0f));

			m_materialsCount = 6;
		}

		~ItemMaterialLibrary()
		{
		}
		//! @}

	public : //! @name State
		//! @{
		const ItemMaterial& getDefault() const
		{
			return m_materials[0];
		}

		const dw::uint32 getMaterialCount() const 
		{
			return m_materialsCount;
		}

		const ItemMaterial& getMaterialFromId(dw::uint32 id) const
		{
			if (id == 255)
				return m_materials[0];

			dwAssert(id < m_materialsCount, "Invalid parameter: id is out of range");

			return m_materials[id];
		}
		//! @}

	private : //! @name Data
		//! @{
		ItemMaterial m_materials[MaterialsMaxCount];
		dw::uint32 m_materialsCount;
		//! @}
	};

} // namespace infinity

#endif // !INFINITY_ITEM_MATERIAL_LIBRARY_H
